"""
兴趣相关数据模型
"""
from pydantic import BaseModel, ConfigDict
from typing import Optional, List


class InterestTagResponse(BaseModel):
    """兴趣标签响应模型"""
    model_config = ConfigDict(from_attributes=True)
    
    id: int
    name: str
    name_en: Optional[str] = None
    description: Optional[str] = None
    icon: Optional[str] = None
    color: str = "#007AFF"
    sort_order: int = 0


class UserInterestRequest(BaseModel):
    """用户兴趣请求模型"""
    interest_ids: List[int]


class UserInterestResponse(BaseModel):
    """用户兴趣响应模型"""
    model_config = ConfigDict(from_attributes=True)
    
    id: int
    user_id: int
    interest_id: int
    weight: float = 1.0
    created_at: str
    
    # 关联的兴趣信息
    interest: Optional[InterestTagResponse] = None


class RecommendationRequest(BaseModel):
    """推荐请求模型"""
    limit: int = 20
    offset: int = 0


class ContentRecommendation(BaseModel):
    """内容推荐响应模型"""
    model_config = ConfigDict(from_attributes=True)
    
    id: int
    user_id: int
    title: Optional[str]
    content: str
    media_urls: Optional[List[str]]
    tags: Optional[List[str]]
    like_count: int
    view_count: int
    created_at: str
    
    # 发布者信息
    author_nickname: Optional[str] = None
    author_avatar: Optional[str] = None

